﻿using System;

using Top.Api;
using Top.Api.Response;
using DreamCube.Foundation.Basic.Utility;

namespace DreamCube.TaobaoGJ.BLL.Api
{
    internal static class ApiCommon
    {
        /// <summary>
        /// 记录调用API发生的异常
        /// </summary>
        /// <param name="apiName"></param>
        /// <param name="funcName"></param>
        /// <param name="errorMsg"></param>
        public static void MakeLog(String apiName, String funcName, String errorCode, String errorMsg, String subErrorCode, String subErrorMsg)
        {
            MyLog.MakeLog(String.Format("{0}.{1}发生异常：【{2}：{3}】-->【{4}：{5}】", apiName, funcName, errorCode, errorMsg, subErrorCode, subErrorMsg));
        }

        /// <summary>
        /// 记录调用API发生的异常
        /// </summary>
        /// <param name="apiName"></param>
        /// <param name="funName"></param>
        /// <param name="req"></param>
        public static void MakeLog(String apiName, String funName, TopResponse res)
        {
            ApiCommon.MakeLog(apiName, funName, res.ErrCode, res.ErrMsg, res.SubErrCode, res.SubErrMsg);
        }
    }
}
